package com.dev.ac.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

import lombok.Data;

/**
 * @TableName a_user
 */
@TableName(value = "a_user")
@Data
public class AUser implements Serializable {
	/**
	 *
	 */
	@TableId(type = IdType.AUTO)
	private Integer id;

	/**
	 *
	 */
	private String username;

	/**
	 *
	 */
	private String password;

	/**
	 *
	 */
	private String nickname;

	/**
	 *
	 */
	private String address;

	/**
	 *
	 */
	private String email;

	/**
	 * 第二课堂分
	 */
	private Double secondPoints;

	/**
	 * 德育分
	 */
	private Double moralEducationPoints;

	/**
	 * 账号创建时间
	 */
	private LocalDateTime createTime;

	/**
	 * 是否禁用
	 */
	private Integer isDelete;
	private String department;
	private String school;

	/**
	 * 角色id
	 */
	private Integer roleId;

	@TableField(exist = false)
	private static final long serialVersionUID = 1L;
	@TableField(exist = false)
	private String user="CLIENT";

	@Override
	public boolean equals(Object that) {
		if (this == that) {
			return true;
		}
		if (that == null) {
			return false;
		}
		if (getClass() != that.getClass()) {
			return false;
		}
		AUser other = (AUser) that;
		return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
				&& (this.getUsername() == null ? other.getUsername() == null : this.getUsername().equals(other.getUsername()))
				&& (this.getPassword() == null ? other.getPassword() == null : this.getPassword().equals(other.getPassword()))
				&& (this.getNickname() == null ? other.getNickname() == null : this.getNickname().equals(other.getNickname()))
				&& (this.getAddress() == null ? other.getAddress() == null : this.getAddress().equals(other.getAddress()))
				&& (this.getEmail() == null ? other.getEmail() == null : this.getEmail().equals(other.getEmail()))
				&& (this.getSecondPoints() == null ? other.getSecondPoints() == null : this.getSecondPoints().equals(other.getSecondPoints()))
				&& (this.getMoralEducationPoints() == null ? other.getMoralEducationPoints() == null : this.getMoralEducationPoints().equals(other.getMoralEducationPoints()))
				&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
				&& (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()))
				&& (this.getRoleId() == null ? other.getRoleId() == null : this.getRoleId().equals(other.getRoleId()));
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
		result = prime * result + ((getUsername() == null) ? 0 : getUsername().hashCode());
		result = prime * result + ((getPassword() == null) ? 0 : getPassword().hashCode());
		result = prime * result + ((getNickname() == null) ? 0 : getNickname().hashCode());
		result = prime * result + ((getAddress() == null) ? 0 : getAddress().hashCode());
		result = prime * result + ((getEmail() == null) ? 0 : getEmail().hashCode());
		result = prime * result + ((getSecondPoints() == null) ? 0 : getSecondPoints().hashCode());
		result = prime * result + ((getMoralEducationPoints() == null) ? 0 : getMoralEducationPoints().hashCode());
		result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
		result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
		result = prime * result + ((getRoleId() == null) ? 0 : getRoleId().hashCode());
		return result;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(getClass().getSimpleName());
		sb.append(" [");
		sb.append("Hash = ").append(hashCode());
		sb.append(", id=").append(id);
		sb.append(", username=").append(username);
		sb.append(", password=").append(password);
		sb.append(", nickname=").append(nickname);
		sb.append(", address=").append(address);
		sb.append(", email=").append(email);
		sb.append(", secondPoints=").append(secondPoints);
		sb.append(", moralEducationPoints=").append(moralEducationPoints);
		sb.append(", createTime=").append(createTime);
		sb.append(", isDelete=").append(isDelete);
		sb.append(", roleId=").append(roleId);
		sb.append(", serialVersionUID=").append(serialVersionUID);
		sb.append("]");
		return sb.toString();
	}
}